'use strict'

var iphone = require('./device/ios')
var path = require("path")
var core = require('./core.js')
var resizeImgWithArgs = core.resizeImgWithArgs;
var resizeImgWithFullArgs = core.resizeImgWithFullArgs;

// resizeImgWithArgs('D:\\project\\xgp-icon-generator\\1.png','D:\\project\\xgp-icon-generator\\2.png',100)

function iosIcon(imgSrc,dirSrc){
    var iconJson = require('./device/cordova-ios-icon.json')
    var imgsInfo = iconJson.images;
    for (let i = 0; i < imgsInfo.length; i++) {
        const el = imgsInfo[i];
        const size = el.size.split('x');
        let scale = Number(el.scale.replace('x',''))
        resizeImgWithFullArgs(imgSrc,dirSrc+"/"+el.filename,100,size[0]*scale,size[1]*scale,'png')
    }
    // resizeImgWithArgs('./1.png','D:\\project\\xgp-icon-generator\\2.png',100)
}

function iosSplash(imgSrc,dirSrc){
    var imgsInfo = iphone.splashSizes();
    for (let i = 0; i < imgsInfo.length; i++) {
        const el = imgsInfo[i];
        
        resizeImgWithFullArgs(imgSrc,dirSrc+"/"+el.name,100,el.width,el.height,'png')
    }
}
iosIcon('./1.png','./dist/ios/icon')

iosSplash('./splash.jpg','./dist/ios/splash')